<?php
class HELLO
{
    public function call($request)
    {/*{{{*/
        $paras=self::check_para($request);
        if($paras === false)
            return array('errcode'=>SOAR_ERR::PARA);
        if(isset($paras['errcode']))
            return array('errcode'=>$paras['errcode']);

        $response=array('errcode'=>SOAR_ERR::OK,
                'size'=>strlen($paras['msg']));

        return $response;
    }/*}}}*/

    private function check_para($request)
    {/*{{{*/
        $paras=array();

        if(!isset($request['msg']))
        {
            $paras['msg']='';
        }
        else
        {
            $msg=trim($request['msg']);
            if(strlen($msg) > misc::LONG_NAME_SIZE)
            {
                errlog::add("%s: msg(%s) invalid",
                        __METHOD__, $request['msg']);
                return false;
            }
            $paras['msg']=$msg;
        }

        return $paras;
    }/*}}}*/
}
?>
